const config = require('../config/common_cfg')
const jwt = require('jsonwebtoken')

module.exports = async (userId) => {
    const key = config.jwt.secret
    const expire = config.jwt.expire

    const token = jwt.sign({
        id: userId
    }, key, {
        expiresIn: expire
    });
    return token
}